/**
 * 
 */
package com.faxsun.core.service;

import java.util.List;

import mblog.core.pojos.Comment;
import mtons.modules.pojos.Page;

/**
 * @author langhsu
 * @author songdragon 2015-04-29 14:49
 *
 */
public interface CommentService {
    
    static final String REPLY_TOKEN = "_@ReplY@_";
    
    static final String REPLY_FORMAT = "{0}" + REPLY_TOKEN + "{1}" + REPLY_TOKEN;
    
	/**
	 * 查询评论列表
	 * @param page
	 * @param toId
	 * @param type 评论类型 {@link Comment#COMMENT_TO_POST},{@link Comment#COMMENT_TO_PRODUCT}
	 */
	void paging(Page page, long toId,int type,int status);	

    /**
     * 查询用户站内信列表
     * @param page
     * @param userId
     * @param status
     */
    void pagingInbox(Page page, long userId, int status);
	
	/**
	 * 发表评论
	 * @param comment
	 * @return
	 */
	long post(Comment comment);
	
	/**
	 * 返回对于toId，且类型未type的评论数目
	 * @param toId 被评论对象id，可以是tagId，或者post_id
	 * @param type 评论类型 {@link Comment#COMMENT_TO_POST},{@link Comment#COMMENT_TO_PRODUCT}
	 * @return 评论条数
	 */
	long count(Long toId, int type);
	
	/**
	 * 将评论标记为删除，并对于Comment评论的实体评论数－1
	 * @param id
	 */
	void delete(long id);
	
	/**
	 * return all comments starting with startId which aims to toId with given type and status, 
	 * descending order on created time, 
	 * removing those comment whose author listed in blacklistAuthors
	 * @param toId
	 * @param startId, optional
	 * @param endId, optional
     * @param size
	 * @param type
	 * @param status
	 * @param blacklistAuthors
	 * @return
	 */
	List<Comment> getCommentsFrom(long toId, long startId, long endId, int size, List<Integer> types, int status, List<Long> blacklistAuthors); 
	
	long getMaxCommentIdFrom(long toId, int type, int status, List<Long> blacklistAuthors);
}
